
ac.item('大法师吊坠'){
    cool = 4,
    used_flag = false,
    item_type = 'permanent',
}
ac.buff('大法师吊坠'){
    model1 = [[ZBJN_lf.mdl]],
    on_add = function(self)
		local unit = self.owner
        self:gc(unit:event '单位-攻击命中'(function(_,_,target,data)
            if self.item:is_cooling()==false and math.random(100)<=15 then
                self.item:active_cd()
                local point = target:get_point()
                local damage = unit:get('全属性') * 2
                point:add_effect(self.model1):remove()
                unit:aoe_damage(point,250,damage,self)
            end
        end))
    end,
}

ac.buff('火山战锤'){
    on_add = function(self)
		local unit = self.owner
        self:gc(unit:add('杀敌力量',0.2))
    end,
}

ac.buff('湮灭匕首'){
    on_add = function(self)
		local unit = self.owner
        self:gc(unit:add('杀敌敏捷',0.2))
    end,
}


ac.buff('亡魂权杖'){
    on_add = function(self)
		local unit = self.owner
        self:gc(unit:add('杀敌智力',0.2))
    end,
}


ac.buff('追猎长弓'){
    on_add = function(self)
		local unit = self.owner
        local last = nil
        self.count = 0
        self:gc(unit:event '单位-攻击命中'(function(_,_,target,data)
            if last==target then
                if self.count<10 then
                    self.count = self.count + 1
                    unit:add('攻击速度',10)
                end
            else
                last = target
                unit:add('攻击速度',-self.count*10)
                self.count = 0
            end
            self.item:set_count(self.count)
        end))
    end,
    on_remove = function(self)
		local unit = self.owner
        unit:add('攻击速度',-self.count*10)
        self.count = 0
    end,
}



ac.buff('切割者战斧'){
    on_add = function(self)
		local unit = self.owner
        local last = nil
        self.count = 0
        self:gc(unit:event '单位-触发暴击'(function(_,_,target,data)
            if math.random(100)<=5 then
                target:add_buff '切割者战斧-效果'{
                    time = 3,
                    art = self.art,
                    on_add = function(buff)
                        buff:gc(target:add('额外护甲',-10))
                    end,
                }
            end
        end))
    end,
}


ac.buff('贤者传承'){
    on_add = function(self)
		local unit = self.owner
        local count = unit:get_data('贤者传承-次数') or 0
        self.item:set_count(count)
        self:gc(unit:event '单位-英雄升级'(function(_,_,target,data)
            local count = unit:get_data('贤者传承-次数') or 0
            if count<12 then
                unit:add('全属性加成',1)
                unit:set_data('贤者传承-次数',count+1)
                self.item:set_count(count)
            end
        end))
    end,
}


ac.buff('光明物质'){
    on_add = function(self)
		local unit = self.owner
        local count = unit:get_data('光明物质-次数') or 0
        self.item:set_count(count)
        self:gc(ac.loop(60 * 1000,function()
            local count = unit:get_data('光明物质-次数') or 0
            if count<10 then
                unit:add('物理固伤加成',1)
                unit:set_data('光明物质-次数',count+1)
                self.item:set_count(count+1)
            end
        end))
    end,
}


ac.buff('黑暗物质'){
    on_add = function(self)
		local unit = self.owner
        local count = unit:get_data('黑暗物质-次数') or 0
        self.item:set_count(count)
        self:gc(ac.loop(60 * 1000,function()
            local count = unit:get_data('黑暗物质-次数') or 0
            if count<10 then
                unit:add('魔法固伤加成',1)
                unit:set_data('黑暗物质-次数',count+1)
                self.item:set_count(count + 1)
            end
        end))
    end,
}


ac.buff('破败之剑'){
    on_add = function(self)
		local unit = self.owner
        self:gc(unit:add('杀敌攻击',0.2))
    end,
}


ac.buff('守护之心'){
    on_add = function(self)
		local unit = self.owner
        self:gc(unit:add('杀敌生命',2))
    end,
}
